﻿using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Routing;

namespace MingYuanyun.WebApi.Abstractions
{
    public static class MvcOptionsExtensions
    {
        public static void AddApiVersionRoutePrefixConvention(
            this MvcOptions options,
            IRouteTemplateProvider routeTemplateProvider)
        { 
            options.Conventions.Add(new ApiVersionRoutePrefixConvention(routeTemplateProvider));
        }

        public static void AddApiVersionRoutePrefixConvention(this MvcOptions options, string routeTemplate)
        {
            options.AddApiVersionRoutePrefixConvention(new RouteAttribute(routeTemplate));
        }
    }
}
